package cn.otrue.patienthealthmanager.adapter;

import java.util.List;
import java.util.Map;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import cn.otrue.patienthealthmanager.R;

public class CenterHelpAdpater extends BaseAdapter {

	private List<Map<String, String>> goods;
	private LayoutInflater inflater;
	private Context context;

	private TextView tv_bangzhu;
	private TextView tv_bangzhuneirong;

	public CenterHelpAdpater(List<Map<String, String>> goods, Context context) {
		this.goods = goods;
		inflater = LayoutInflater.from(context);
		this.context = context;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return goods.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return goods.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		convertView = inflater.inflate(R.layout.item_dactor_bangzhu, null);
		tv_bangzhu = (TextView) convertView.findViewById(R.id.tv_bangzhu);
		tv_bangzhuneirong = (TextView) convertView
				.findViewById(R.id.tv_bangzhuneirong);
		Map<String, String> eachMap = goods.get(position);
		if (eachMap != null) {
			tv_bangzhu.setText(eachMap.get("title"));
			tv_bangzhuneirong.setText(eachMap.get("Context"));
		}

		return convertView;
	}

}
